package cn.wolfcode.luowowo.search.domain;

import lombok.Getter;
import lombok.Setter;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;

@Document(indexName="luowowo_question_answer",type="question_answer")
@Getter
@Setter
public class QuestionAnswerTemplate implements Serializable{

    public static final String INDEX_NAME = "luowowo_question_answer";
    public static final String TYPE_NAME = "question_answer";

    @Id
//@Field 每个文档的字段配置（类型、是否分词、是否存储、分词器 ）
    @Field(store=true, index = true,type = FieldType.Long)
    private Long id;
    @Field(store=true, index = true,type = FieldType.Long)
    private Long userId; //用户id
    @Field(store=true, index = true,type = FieldType.Long)
    private Long questionId; //问题id
    @Field(index=true,analyzer="ik_max_word",store=true,searchAnalyzer="ik_max_word",type = FieldType.Text)
    private String questionTitle; //问题标题
    @Field(store=true, index = true,type = FieldType.Keyword)
    private String username; //用户名
    @Field(index=true,store=true,type = FieldType.Integer)
    private Integer level; //用户等级
    @Field(store=true, index = true,type = FieldType.Keyword)
    private String headUrl; //用户头像
    @Field(index=true,analyzer="ik_max_word",store=true,searchAnalyzer="ik_max_word",type = FieldType.Text)
    private String content; //评论内容
    @Field(store=true, index = true,type = FieldType.Integer)
    private int thumbupnum; //点赞
}
